<?php

namespace app\admin\model\performance;

use think\Model;
use traits\model\SoftDelete;

class Percom extends Model
{

    use SoftDelete;

    

    // 表名
    protected $name = 'percom';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [
        'type_text',
        'status_text',
        'gtype_text',
        'i1type_text',
        'i3type_text'
    ];
    

    
    public function getTypeList()
    {
        return ['0' => __('Type 0'), '1' => __('Type 1'), '2' => __('Type 2')];
    }

    public function getStatusList()
    {
        return ['0' => __('Status 0'), '1' => __('Status 1')];
    }

    public function getGtypeList()
    {
        return ['0' => __('Gtype 0'), '1' => __('Gtype 1')];
    }

    public function getI1typeList()
    {
        return ['0' => __('I1type 0'), '1' => __('I1type 1')];
    }

    public function getI3typeList()
    {
        return ['0' => __('I3type 0'), '1' => __('I3type 1')];
    }


    public function getTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
        $list = $this->getTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getGtypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['gtype']) ? $data['gtype'] : '');
        $list = $this->getGtypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getI1typeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['i1type']) ? $data['i1type'] : '');
        $list = $this->getI1typeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getI3typeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['i3type']) ? $data['i3type'] : '');
        $list = $this->getI3typeList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
